package com.bestcem.xm.deliver.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bestcem.xm.component.mybatis.base.ResultPage;
import com.bestcem.xm.component.mybatis.service.impl.XmServiceImpl;
import com.bestcem.xm.deliver.entity.DeliverOrgSmsTemplate;
import com.bestcem.xm.deliver.mapper.DeliverOrgSmsTemplateMapper;
import com.bestcem.xm.deliver.service.DeliverOrgSmsTemplateService;
import com.bestcem.xm.deliver.util.PageUtil;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.Objects;

/**
* @author been
* @description 针对表【ds_deliver_orgsmstemplate】的数据库操作Service实现
* @createDate 2022-11-07 13:49:46
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class DeliverOrgSmsTemplateServiceImpl extends XmServiceImpl<DeliverOrgSmsTemplateMapper, DeliverOrgSmsTemplate>
    implements DeliverOrgSmsTemplateService{

    private @NonNull DeliverOrgSmsTemplateMapper deliverOrgSmsTemplateMapper;

    @Override
    public ResultPage<DeliverOrgSmsTemplate> orgSmsTemplates(Integer page, Integer size) {
        if (Objects.nonNull(page) || Objects.nonNull(size)) {
            page = Objects.nonNull(page) ? page : 1;
            size = Objects.nonNull(size) ? size : 10;
            Page<DeliverOrgSmsTemplate> data = deliverOrgSmsTemplateMapper.selectPage(new Page<>(page, size), null);
            return PageUtil.getResultPage(data.getCurrent(), data.getTotal(), data.getRecords());
        }
        return null;
    }
}




